{include file="public/layout" /}
<body class="bodystyle" style="min-width: auto;">
<form id="productimg_form" name="productimg_form" class="form-horizontal" action="" method="post">
    <input type="hidden" name="id" value="{$field.id}">
    <div class="ncap-form-default">
        <dl class="row">
            <dt class="tit">
                <label for="title"><em>*</em>标题</label>
            </dt>
            <dd class="opt">
                <input type="text" name="title" value="{$field.title}" id="title" class="input-txt">
                <span class="err"></span>
                <p class="notic"></p>
            </dd>
        </dl>
        <div class="bot">
            <a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
            &nbsp;
            <a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-red" id="closeBtn">关闭</a>
        </div>
    </div>
</form>
<script type="text/javascript">
    $(function () {
     
        $('#submitBtn').click(function(){
            $('#productimg_form').submit();
        });

        $('#closeBtn').click(function(){
            window.parent.layer.closeAll();
        });
        
        $("#productimg_form").validate({
            debug: false, //调试模式取消submit的默认提交功能   
            focusInvalid: false, //当为false时，验证无效时，没有焦点响应  
            onkeyup: false,   
            submitHandler: function(form){   //表单提交句柄,为一回调函数，带一个参数：form   
                $.ajax({
                    url:"{:U('Product/ajax_edit_productimg', ['_ajax'=>1])}",
                    type:'post',
                    dataType:'json',
                    data: $("#productimg_form").serialize(),
                    success:function(data){
                        if(data.status !=1){
                            layer.alert(data.msg, {icon: 2, title:false});
                        }else{
                            layer.alert(data.msg, {icon: 1, title:false}, function(){
                                window.parent.layer.closeAll();
                            });
                        }  
                    }
                });
            },  
            ignore:":button",   //不验证的元素
            rules:{
                title:{
                    required:true
                }
            },
            messages:{
                title:{
                    required:"标题不能为空"
                }
            }
        });
        
    });
</script>

{include file="public/footer" /}